<?php

include 'Cabecalho.php';
include 'Menu.php';
include 'Principal.php';
include 'Rodape.php';

class Aplication{

	public $cabecalho;
	public $rodape;
	public $principal;
	public $menu;

	function __construct(){
		$this->cabecalho = new Cabecalho();
		$this->principal = new Principal();
		$this->menu = new Menu();
		$this->rodape = new Rodape();
	}

	function run(){

		if(array_key_exists("palavra",$_GET)) {
			$palavra = $_GET['palavra'];
		} else {
			$palavra = '';
		}
		if(array_key_exists("qtdRegistros",$_GET)) {
			$qtdRegistros = $_GET['qtdRegistros'];
		} else {
			$qtdRegistros = 5;
		}
	
		echo("<div id='geral'>");

		$this->cabecalho->showHtml();
			
		echo("<div id='centro'>");
			
		$this->menu->showHtml();

		echo("<div id='busca'>");
		echo ("<form id='formUsuario' action='./index.php' method='get' >
  			<input value='{$palavra}' type='text' name='palavra' size='35'/> 
  			<input type='hidden' name='qtdRegistros' value='{$qtdRegistros}' />
			<input type='submit' value='Buscar'/></form>");
		echo("</div>");
		$this->principal->showHtml();
		echo("</div>");
			
		$this->rodape->showHtml();

		echo("</div>");
	}

}
?>